<!doctype html>
<meta charset="utf-8">
<title>form.elements: indexed access reflects DOM order, not flat tree</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<form id="target">
  <div id="host">
    <template shadowrootmode="open">
      <slot name="first"></slot>
      <slot name="second"></slot>
    </template>
    <input id="first" slot="second">
    <input id="second" slot="first">
  </div>
</form>
<script>
test(function() {
  let target = document.getElementById("target");
  let host = document.getElementById("host");
  assert_true(!!host.shadowRoot, "Should have a shadow tree");
  assert_equals(target.elements[0], first, "form.elements reflects DOM order, not flat tree order");
  assert_equals(target.elements[1], second);
});
</script>
